package 我的Java学习_算法基础.day_03;

import java.util.Arrays;
import java.util.Random;

public class _057_用计数排序解决员工年龄问题 {
    public static void main(String[] args) {
        Random random = new Random();
        int[] a = new int[10000];
        for (int i = 0; i < a.length; i++) {
            a[i] = random.nextInt(99)+1;
        }
        solve(a);
    }
    private static void solve(int[] array){
        int[] helper = new int[100];
        int current = 0;
        for (int e:array
             ) {
            helper[e]++;
        }
        for (int i = 0; i < helper.length; i++) {
            while(helper[i]>0){
                array[current++] = i;
                helper[i]--;
            }
        }
        System.out.println(Arrays.toString(array));
    }
}
